<?php $id = getId(); ?>
<?php $arr=$this->get('post');?>
	<form action="<?php _baseUrl()?>/Asset/Index/delete"  method="post" id="f<?php _e($id);?>">
		<div class="x-list-title">
			<table width="100%" border="0" height="100%">
				<tr>
					<td align="left">
						<h2>
							<?php if($this->get('title')){?>
								<?php _e( $this->get('title'));?> 
							<?php }else{_e("Danh sách tài sản");}?>
						</h2>
					</td>
					<td align="right">	
						<div class="x-list-options">
						<a class="x-button" href="#Asset/Index/Add"> Tài sản mới </a>
							<div class="x-options-container">
								
								<a class="x-button">Tác vụ khác  <span class="x-tri">&#9660;</span></a> 
								<div class="x-options">
									
									<a onclick="module_ajax('<?php _moduleUrl($this);?>/Act/delete','f<?php _e($id);?>',this)" class="x-options-item" >Xóa tài sản</a>
									<a onclick="module_ajax('<?php _moduleUrl($this);?>/Act/changestatus','f<?php _e($id);?>',this)"  class="x-options-item x-track">Chuyển tình trạng</a>
									<a class="x-options-item" onclick="module_frame('<?php _moduleUrl($this);?>/Export','f<?php _e($id);?>', this)">Export Excel</a>
								</div>
							</div>
						</div>
					</td>
				</tr>
			</table>	
		</div>
		<table width="100%" cellpadding="5" class="x-list" >
			<tr>
				<th  align="center" width="30">TT</th>
				<?php $vars = $this->get('vars');?>
				<th width="250">
					<?php show_order_link('Tên tài sản','title','#Asset',$vars) ;?>
				</th>
				<th width="100">
				<?php show_order_link('Tình trạng','status','#Asset',$vars) ;?>
				</th>
				<th width="80">
				<?php show_order_link('Hãng','origin','#Asset',$vars) ;?>
				</th>
				<th width="100">
				<?php show_order_link('Ngày mua','datebuy','#Asset',$vars) ;?>
				</th>
				<th>
				<?php show_order_link('Địa điểm mua','department_id','#Asset',$vars) ;?>
				</th>
				
				<th width="25" colspan="2">Tác vụ</th>
				
				<th align="center" width="25">
					<div class="x-check-container">
						<div class="x-check">
						<input type="checkbox" class="x-checkbox x-checkall"/>
						</div>
						<div class="x-check-options">
							<a class="x-check-item check-all">Chọn tất cả</a>
							<a class="x-check-item uncheck-all">Bỏ chọn tất cả</a>
						</div>
					</div>
				</th>
			</tr>
			<?php
			if(count($arr)==0){
				_e("<tr><td class='page' colspan='10'><div class='x-page'>Chưa có tài sản nào được tạo.</div></td></tr>");
			}else{
				foreach( $arr as $k=>$a ){?>
				<tr>
					<td align="center"><?php _e($k+1);?></td>
					<td><a href="#asset/Index/View?ID=<?php _e($a['ID']);?>"><?php _e($a['title']);?></a></td>
					<td><?php if($a['status']=="dont"){_e("Chưa sử dụng");}else{_e("Đang sử dụng");};?></td>
					<td align="center"><?php _e($a['origin']);?></td>
					<td align="center"><?php _e(show_date(DATE_FORMAT,$a['datebuy']));?></td>
					<td><?php _e($a['buyat']);?></td>
					
					<td width="25" align="center">
						<?php if($this->get('user_id')==$a['created_by_id']){?>
						<a href="#Asset/Index/edit?ID=<?php _e($a['ID']);?>" class="x-edit"></a>
						<?php }else{?>
						<a class="x-noedit"></a>
						<?php }?>
					</td>
					<td width="25" align="center">
						<?php if($this->get('user_id')==$a['created_by_id']){?>
						<a onclick="module_delete('<?php _baseUrl()?>/asset/Index/delete?ID=<?php _e($a['ID']);?>')" class="x-delete"></a>
						<?php }else{?>
						<a class="x-nodelete"></a>
						<?php }?>
					</td>
					<td align="center">
						<input name="ID[]" value="<?php _e($a['ID'])?>" type="checkbox" class="x-checkbox x-checkall"/>
					</td>
				</tr>
				<?php }
				?>
				<tr>
					<td colspan="10" class="page">
						<div class="x-page">
							<?php $this->e("page");?>
						</div>		
					</td>
				</tr>
				<?php
			}
			?>
			
		</table>
	</form>
